Conversation
… path, and make it alert those files when importing an X archive
… archive path, and make it alert those files when importing an X archive" This reverts commit 0a36a15.
…alog into a single function, showOpenDialog, with settings to allow for selecting folders, selecting files, and filtering files. Make the two places that used these functions (advanced settings modal, and importing X archive) use the new function. When importing the X archive, if the path selected is not a ZIP file, treat it like an already unzipped folder.
SaptakS
left a comment
There was a problem hiding this comment.
The file and folder selector together doesn't work in linux (I tested) and windows. Left some inline comments regarding the same.
| } catch (error) { | ||
| throw new Error(packageExceptionForReport(error as Error)); | ||
| if (selectFiles) { | ||
| properties.push('openFile'); |
There was a problem hiding this comment.
I had actually tried implementing the first time I was implementing this feature, but found out that this doesn't work with Windows and Linux.
From the docs:
Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
So basically when I test it in Linux, that selector is just a folder selector, and I can't select zip files. I think the solution might be to give 2 different selectors (which I know looks terrible, but I don't know a way around).
There was a problem hiding this comment.
Eeek. I only tested in macOS. Okay, I'll make changes.
Fixes #364
As described in the issue, it turns out if the user download their X archive from Safari on a Mac, Safari will automatically unzip it. If they try zipping it up again, the resulting zip file will have the archive in a nested folder, which Cyd isn't looking for.
This PR fixes it by allowing the user to select either the zip file or the already-unzipped folder. It refactors the IPC functions showSelectZIPFileDialog and showSelectFolderDialog into a single function, showOpenDialog, with settings to allow for selecting folders, selecting files, and filtering files.